head = '<body bgcolor="#f0f0f8">' + pydoc.html.heading('<big><big>%s</big></big>' % strong(pydoc.html.escape(str(etype))), '#ffffff', '#6622aa', pyver + '<br>' + date) + '\n<p>A problem occurred in a Python script. Here is the sequence of\nfunction calls leading up to the error, in the order they occurred.</p>'
indent = '<tt>' + small(' ' * 5) + ' </tt>'
frames = []
records = inspect.getinnerframes(etb, context)
for frame, file, lnum, func, lines, index in records:
if file:
file = os.path.abspath(file)
link = '<a href="file://%s">%s</a>' % (file, pydoc.html.escape(file))
return head + ''.join(frames) + ''.join(exception) + "\n\n\n<!-- The above is a description of an error in a Python program, formatted\n for a Web browser because the 'cgitb' module was enabled. In case you\n are not reading this in a Web browser, here is the original traceback:\n\n%s\n-->\n" % ''.join(traceback.format_exception(etype, evalue, etb))
def text(.0, context = 5):
'''Return a plain text document describing a given traceback.'''
head = '%s\n%s\n%s\n' % (str(etype), pyver, date) + '\nA problem occurred in a Python script. Here is the sequence of\nfunction calls leading up to the error, in the order they occurred.\n'
frames = []
records = inspect.getinnerframes(etb, context)
for frame, file, lnum, func, lines, index in records:
return head + ''.join(frames) + ''.join(exception) + '\n\nThe above is a description of an error in a Python program. Here is\nthe original traceback:\n\n%s\n' % ''.join(traceback.format_exception(etype, evalue, etb))
class Hook:
'''A hook to replace sys.excepthook that shows tracebacks in HTML.'''